package com.kang.controller;

import com.kang.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author 吃三明治派对中的康康
 * @Date 2022/5/4 19:43
 * @Version 1.0
 */
@Controller
public class OrderController {

    @Autowired
    OrderService orderService;

    @RequestMapping("/userOrder")
    public String userOrder(Model model, HttpServletRequest request){
        if(request.getSession().getAttribute("UserSession") == null) return "redirect:/toLogin";
        model.addAttribute("userOrderModel",orderService.searchAllOrder());
        return "userOrder";
    }
}
